﻿@model GdprLogSearchModel


@{
    //page title
    ViewBag.PageTitle = T("Admin.Customers.GdprLog").Text;
    //active menu item (system name)
    NopHtml.SetActiveMenuItemSystemName("GDPR log");
}

@{
    const string hideSearchBlockAttributeName = "GdprLogPage.HideSearchBlock";
    var hideSearchBlock = await genericAttributeService.GetAttributeAsync<bool>(await workContext.GetCurrentCustomerAsync(), hideSearchBlockAttributeName);
}

    <form asp-controller="Customer" asp-action="GdprLogList" method="post">
        <div class="content-header clearfix">
            <h1 class="float-left">
                @T("Admin.Customers.GdprLog")
            </h1>
            <div class="float-right">
                &nbsp;
            </div>
        </div>

        <section class="content">
            <div class="container-fluid">
                <div class="form-horizontal">
                    <div class="cards-group">
                        <div class="card card-default card-search">
                            <div class="card-body">
                                <div class="row search-row @(!hideSearchBlock ? "opened" : "")" data-hideAttribute="@hideSearchBlockAttributeName">
                                    <div class="search-text">@T("Admin.Common.Search")</div>
                                    <div class="icon-search"><i class="fas fa-magnifying-glass" aria-hidden="true"></i></div>
                                    <div class="icon-collapse"><i class="far fa-angle-@(!hideSearchBlock ? "up" : "down")" aria-hidden="true"></i></div>
                                </div>

                                <div class="search-body @(hideSearchBlock ? "closed" : "")">
                                    <div class="row">
                                        <div class="col-md-5">
                                            <div class="form-group row">
                                                <div class="col-md-4">
                                                    <nop-label asp-for="SearchEmail" />
                                                </div>
                                                <div class="col-md-8">
                                                    <nop-editor asp-for="SearchEmail" />
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-7">
                                            <div class="form-group row">
                                                <div class="col-md-4">
                                                    <nop-label asp-for="SearchRequestTypeId" />
                                                </div>
                                                <div class="col-md-8">
                                                    <nop-select asp-for="SearchRequestTypeId" asp-items="Model.AvailableRequestTypes" />
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="text-center col-12">
                                            <button type="button" id="search-log" class="btn btn-primary btn-search">
                                                <i class="fas fa-magnifying-glass"></i>
                                                @T("Admin.Common.Search")
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="card card-default">
                            <div class="card-body">
                                <nop-doc-reference asp-string-resource="@T("Admin.Documentation.Reference.Gdpr", Docs.Gdpr + Utm.OnAdmin)" />

                                @await Html.PartialAsync("Table", new DataTablesModel
                                {
                                    Name = "log-grid",
                                    UrlRead = new DataUrl("GdprLogList", "Customer", null),
                                    SearchButtonId = "search-log",
                                    Length = Model.PageSize,
                                    LengthMenu = Model.AvailablePageSizes,
                                    Filters = new List<FilterParameter>
                                    {
                                        new FilterParameter(nameof(Model.SearchRequestTypeId)),
                                        new FilterParameter(nameof(Model.SearchEmail))
                                    },
                                    ColumnCollection = new List<ColumnProperty>
                                    {
                                        new ColumnProperty(nameof(GdprLogModel.CustomerInfo))
                                        {
                                            Title = T("Admin.Customers.GdprLog.Fields.CustomerInfo").Text
                                        },
                                        new ColumnProperty(nameof(GdprLogModel.RequestType))
                                        {
                                            Title = T("Admin.Customers.GdprLog.Fields.RequestType").Text
                                        },
                                        new ColumnProperty(nameof(GdprLogModel.RequestDetails))
                                        {
                                            Title = T("Admin.Customers.GdprLog.Fields.RequestDetails").Text
                                        },
                                        new ColumnProperty(nameof(GdprLogModel.CreatedOn))
                                        {
                                            Title = T("Admin.Customers.GdprLog.Fields.CreatedOn").Text,
                                            Render = new RenderDate()
                                        }
                                    }
                                })
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </form>